package cn.echo.modules.sys.service;



import cn.echo.modules.sys.dao.FeedBackMapper;
import cn.echo.modules.sys.entity.FeedBack;
import cn.echo.modules.sys.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/4/21.
 */
@Service
public class FeedBackService {
    @Autowired
    FeedBackMapper feedBackMapper;
    //添加反馈
    public void add(FeedBack feedBack){
        try {
            feedBackMapper.add(feedBack);
        } catch (Exception e) {
            System.out.println("添加反馈失败！");
            e.printStackTrace();
        }
    }

    //通过反馈id删除
    public void remove(FeedBack feedBack){
        try {
            feedBackMapper.remove(feedBack);
        } catch (Exception e) {
            System.out.println("删除反馈失败！");
            e.printStackTrace();
        }
    }

    //查找所有反馈
    public List<FeedBack> findAll(FeedBack feedBack){
        List<FeedBack> feedBackList = null;
        try {
            feedBackList = feedBackMapper.findAll(feedBack);
        } catch (Exception e) {
            System.out.println("查询失败");
            e.printStackTrace();
        }
            return feedBackList;
    }

    public FeedBack findById(FeedBack feedBack) {
        FeedBack FeedBack1 = feedBackMapper.findById(feedBack);
        return FeedBack1;
    }

    public void update(FeedBack feedBack) {
        try {
            feedBackMapper.update(feedBack);
        } catch (Exception e) {
            System.out.println("更新失败！");
            e.printStackTrace();
        }
    }
}
